#pragma once
#include "JeayeSDK.h"
#include <JeayeSDK/CharFun.h>
/**/
typedef struct _c_md5 {
	BYTE          buffer[64];      /* input buffer */
	BYTE          digest[16];      /* */
	UINT32        count[2];        /* number of bits, modulo 2^64 (low-order word first) */
	UINT32        state[4];        /* State (ABCD)*/
}c_md5_t;

/**/
JEAYESDK_API void c_md5_init(c_md5_t *);
/**/
JEAYESDK_API void c_md5_update(c_md5_t *, const BYTE*, UINT32);
/**/
JEAYESDK_API void c_md5_finalize(c_md5_t *);

/*
Digests a file.
*/
JEAYESDK_API BOOL c_md5file(const TCHAR*, TCHAR*);
/**/
JEAYESDK_API const wchar_t* c_md5(const BYTE *input, UINT32 length, wchar_t *results);
JEAYESDK_API const char* c_md5(const BYTE *input, UINT32 length, char *results);
/*
//examples 1:
const char_t md5hex[16] = {
'0', '1', '2', '3',
'4', '5', '6', '7',
'8', '9', 'a', 'b',
'c', 'd', 'e', 'f'
};

char_t szPassword[33];

struct _cc_md5 md5ctx;
cc_md5_init(&md5ctx);
cc_md5_update(&md5ctx,_type_cast(const uchar_t*,"B"), strlen("B"));
cc_md5_finalize(&md5ctx);

int index = 0;
for (UINT32 i = 0; i < 16; i++) {
int t = md5ctx.digest[i];
szPassword[index++] = md5hex[t / 16];
szPassword[index++] = md5hex[t % 16];
}
szPassword[index] = '\0';
*/